<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="box">
        <test :msg='pmsg' :setw='500'></test>
    </div>
    <script>
        Vue.component('test',{
            props:['msg','setw'],
            template:"<div :style='setStyle'>接收到的值是:{{msg}}</div>",
            computed:{
                setStyle(){
                    return `width:${this.setw}px`
                }
            }
        })
        var vm=new Vue({
            el:"#box",
            data:{
                pmsg:'父的数据'
            },

        })
    </script>
</body>
</html>